package com.fourth.mapper;

import com.fourth.entity.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.math.BigDecimal;

/**
 * <p>
 * 用户表 Mapper 接口
 * </p>
 *
 * @author 邓建波
 * @since 2022-08-04
 */
public interface UserMapper extends BaseMapper<User> {

    /**
     * fetch data by rule id
     *
     * @param transferMoney  转账金额
     * @param transferPhone  转账用户手机号
     * @return Boolean
     */
    @Update("update tb_user set balance = balance + #{transferMoney} where user_phone = #{transferPhone}")
    boolean addTransfer(@Param("transferPhone") String transferPhone, @Param("transferMoney") BigDecimal transferMoney);
}
